import request from '@/utils/request'


// 查询首页展示数据
export function selectHome() {
  return request({
    url: '/music/home',
    method: 'get'
  })
}
//上传
export function uploadModules(module) {
  return request({
    url: '/music/test/uploadModule',
    method: 'post',
    headers:{'Content-Type':'multipart/form-data'},
    data: module
  })
}

// 查询文章列表
export function getArticles() {
  return request({
    url: 'article/list',
    method: 'get'
  })
}
//根据 id 获取文章信息
export function getArticleByID(id) {
  return request({
    url: '/article/getArticleByID'+'/'+id,
    method: 'get'
  })
}
//网易云扫码登录
export function scanCode(info){
  return request({
    url: '/auth/scanCode',
    data: info,
    method: 'post'
  })
}
//原创音乐列表
export function musicList(){
  return request({
    url: '/music/list',
    method: 'get'
  })
}
//音乐下载
export function downloadMusic(id){
  return request({
    url: '/music/downloadMusic'+'/'+id,
    method: 'get'
  })
}
//喜欢音乐
export function likeMusic(id){
  return request({
    url: '/music/likeMusic'+'/'+id,
    method: 'get'
  })
}

//文章评分
export function getRata(rata,id){
  return request({
    url: '/article/rata'+'/'+rata+'/'+id,
    method: 'get'
  })
}
//我发布的音乐
export function getMyMusic(){
  return request({
    url: '/music/getMyMusic',
    method: 'get'
  })
}


//我的文章
export function getMyArticle(){
  return request({
    url: '/article/getMyArticle',
    method: 'get'
  })
}

//我喜欢的音乐
export function getMyLikes(){
  return request({
    url: '/music/getMyLikes',
    method: 'get'
  })
}
//我的信息
export function getUserDetail(){
  return request({
    url: '/user/getUserDetail',
    method: 'get'
  })
}
//听音乐记录次数
export function listenRecord(id,name,singer){
  return request({
    url: '/music/listenRecord'+'/'+id+'/'+name+'/'+singer,
    method: 'get'
  })
}
//拿到图的数据
export function getListenRecord(){
  return request({
    url: '/music/getListenRecord',
    method: 'get'
  })
}
// 查询用户管理列表
export function listUsers(query) {
  return request({
    url: '/user/list',
    method: 'get',
    params: query
  })
}

// 查询用户管理详细
export function getUsers(userId) {
  return request({
    url: '/user/' + userId,
    method: 'get'
  })
}

// 新增用户管理
export function addUsers(data) {
  return request({
    url: '/user',
    method: 'post',
    headers:{'Content-Type':'multipart/form-data'},
    data: data
  })
}

// 修改用户管理
export function updateUsers(data) {
  return request({
    url: '/user/update',
    method: 'post',
    headers:{'Content-Type':'multipart/form-data'},
    data: data
  })
}

// 删除用户管理
export function delUsers(userId) {
  return request({
    url: '/user/' + userId,
    method: 'delete'
  })
}

// 查询ArticleAdmin列表
export function listArticle(query) {
  return request({
    url: '/article/list',
    method: 'get',
    params: query
  })
}

// 查询ArticleAdmin详细
export function getArticle(id) {
  return request({
    url: '/article/' + id,
    method: 'get'
  })
}

// 新增ArticleAdmin
export function addArticle(data) {
  return request({
    url: '/article',
    method: 'post',
    data: data
  })
}

// 修改ArticleAdmin
export function updateArticle(data) {
  return request({
    url: '/article',
    method: 'put',
    data: data
  })
}
export function updateArticleStatus(id,status) {
  return request({
    url: '/article/updateArticleStatus' +'/'+ id +'/'+status,
    method: 'get'
  })
}


// 删除ArticleAdmin
export function delArticle(id) {
  return request({
    url: '/article/' + id,
    method: 'delete'
  })
}